package com.pti.usermanager.dao.impl;

import com.pti.usermanager.dao.api.DeptDao;
import com.pti.usermanager.dao.mapper.DeptMapper;
import com.pti.usermanager.dao.po.DeptPo;
import com.pti.usermanager.web.dto.request.SaveDeptRequest;
import com.pti.usermanager.web.dto.request.SavePostByDidAndPid;
import com.pti.usermanager.web.dto.request.UpdateDeptRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName: DeptDaoImpl
 * @Author: liumengyao
 * @Description: 部门数据交换层实现层
 * @Date: 2019/1/17
 */
@Repository
public class DeptDaoImpl implements DeptDao{

    @Autowired
    private DeptMapper deptMapper;

    @Override
    public List<DeptPo> findAll(String deptNm) {
        return deptMapper.findAll(deptNm);
    }

    @Override
    public List<DeptPo> findAllCanCheck(String deptNm) {
        return deptMapper.findAllCanCheck(deptNm);
    }

    @Override
    public DeptPo findDeptByDeptId(Long deptId) {
        return deptMapper.findDeptByDeptId(deptId);
    }

    @Override
    public void saveDept(SaveDeptRequest saveDeptRequest) {
        deptMapper.saveDept(saveDeptRequest);
    }

    @Override
    public void updateDept(UpdateDeptRequest updateDeptRequest) {
        deptMapper.updateDept(updateDeptRequest);
    }

    @Override
    public void delDept(Long deptId) {
        deptMapper.delDept(deptId);
    }

    @Override
    public void savePostByDeptIdAndPostId(Long deptId, Long postId) {
        deptMapper.savePostByDeptIdAndPostId(deptId,postId);
    }

    @Override
    public void deletePostByDid(Long deptId) {
        deptMapper.deletePostByDid(deptId);
    }

    @Override
    public void saveUserByDeptIdAndUsrId(Long deptId, Long usrId) {
        deptMapper.saveUserByDeptIdAndUsrId(deptId,usrId);
    }

    @Override
    public List<DeptPo> findTree(Long compId) {
        return deptMapper.findTree(compId);
    }
    @Override
    public void deleteUserByDid(Long deptId) {
        deptMapper.deleteUserByDid(deptId);
    }

}
